﻿using System;
using System.Collections.Generic;
using System.Data.SqlServerCe;
using System.Dynamic;
using System.Linq;
using System.Text;
using Massive;

namespace Tests
{
    public class Membership
    {

        public Membership()
        {
        }

        public dynamic Register(string email, string password, string confirm)
        {
            dynamic result = new ExpandoObject();
            result.Success = false;
            if (email.Length >= 6 && password.Length >= 6 && password.Equals(confirm))
            {
                try
                {
                    var _db = new Users();
                    dynamic entry = new ExpandoObject();

                    entry.Email = email;
                    entry.HashedPassword = password;
                    var r = _db.Insert(entry);
                }
                catch (Exception ex)
                {
                    result.Message = "This email already exists in our.";
                }
                result.Success = true;
            }

            return result;
        }
    }
}
